<?php

namespace McUser\Model;
use Common\Model\CommonModel;

/*
 *  Copyright (c) 2014 The CCP project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
 *  that can be found in the LICENSE file in the root of the web site.
 *
 *   http://www.yuntongxun.com
 *
 *  An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

class WalletBonusModel extends CommonModel {

	protected $trueTableName = 'bg_wallet_bonus';
	
	/*
	*	奖金分配
	*/
	public function add_bonus($userID, $fromUserID, $userRelationship,$fromNiceName, $bonus, $payID){
		$tDate =  date('Y-m-d H:i:s', time());

		$data['userID'] = $userID;
		$data['fromUserID'] = $fromUserID;
		$data['fromNiceName'] = $fromNiceName;
		
		$data['userRelationship'] = $userRelationship;
		$data['bonus'] = $bonus;
		$data['bonusDate'] = $tDate;
		
		$data['payID'] = $payID;

		$this -> add($data);
	}

	/*
	*	读取 Bonus 历史
	*/
	public function read_bonus_his($userID){

		$where['userID'] = $userID;

		$data = $this -> where($where) -> select();
		
		return $data;
	}


}